#include<stdio.h>
#include<string.h>
#include<math.h>

#define MAX 10010

int n;
int v[MAX],start[MAX];
double time[MAX];
double ans;


int main()
{
	int i,j;
	double swap;

	while(1)
	{
		scanf("%d",&n);
		if(n==0) break;

		for(i=0;i<n;i++)
		{
			scanf("%d %d",&v[i],&start[i]);
			if(start[i]>=0)
				time[i]=4.5/v[i]*3600+start[i];
			else
				time[i]=1000000;

		}

		for(i=0;i<n-1;i++)
		{
			for(j=i+1;j<n;j++)
			{
				if(time[i]>time[j])
				{
					swap=time[i]; time[i]=time[j]; time[j]=swap;
				}
			}
		}

		if(floor(time[0])==time[0])
			ans=time[0];
		else
			ans=floor(time[0])+1;


		printf("%.0lf\n",ans);
	}

	return 0;
}

